package com.yixun.qfbao.model.enums;

import org.apache.commons.lang.StringUtils;

public enum PropertyTypeEnum {
	UNLIMITED("UNLIMITED", "不限"),
	RESIDENCE("RESIDENCE", "住宅"),
	VILLA("VILLA", "别墅"),
	HOTEL_APARTMENT("HOTEL_APARTMENT", "酒店式公寓"),
	OFFICE_BUILDING("OFFICE_BUILDING", "写字楼"),
	BOTTOM_COMMERCE("BOTTOM_COMMERCE","底商"),
	GARAGE("GARAGE", "车库"),
	INDUSTRIAL_PREMISES("INDUSTRIAL_PREMISES", "工业厂房"),
	BUNGALOW("BUNGALOW", "平房"),
	BUSINESS("BUSINESS", "商业办公类"),
	OTHER("OTHER", "其他"),
	;

	private String no;
	private String des;

	public String getNo() {
		return no;
	}

	public void setNo(String no) {
		this.no = no;
	}

	public String getDes() {
		return des;
	}

	public void setDes(String des) {
		this.des = des;
	}

	private PropertyTypeEnum(String no, String des) {
		this.no = no;
		this.des = des;
	}

	public static PropertyTypeEnum getByNo(String no) {
		if (StringUtils.isBlank(no)) {
			return null;
		}
		for (PropertyTypeEnum menum : values()) {
			if (menum.getNo().equals(no)) {
				return menum;
			}
		}
		return null;
	}

	public static String getNameByCode(String code) {
		if (!StringUtils.isEmpty(code)) {
			PropertyTypeEnum anEnum = getByNo(code);
			if (anEnum != null) {
				return anEnum.getDes();
			} else {
				return null;
			}
		}
		return null;
	}

}
